<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends BaseController {
    public function index(){
        // $m = D("text");
        // $count      = $m->count();
        // $Page       = new \Think\Page($count,10);
        // $show       = $Page->show();// 分页显示输出
        

        // $this->assign('page',$show);// 赋值分页输出
        $Model = new \Think\Model();
        $sql = "select u.nickname uname,t.id tid,t.picname tpname,t.name tname,t.content tcontent,t.view tview,t.createtime ctime from pro_user as u, pro_pathclass as p ,pro_text as t where u.id=t.bid AND t.tid = p.id AND t.status = 1 order by tid desc LIMIT 3";
        //$list = $m->where("status = 1")->order('id desc')->limit($Page->firstRow.','.$Page->listRows);
        $list = $Model->query($sql);
        //dump($data);
        $this->assign('data',$list);

        
        
    	$slides = M("slides");
        $slidesList = $slides->order("id desc")->select();
        $this->assign("slidesList",$slidesList);
        $this->assign("slidesLists",$slidesList);
        $this->display();
           
    }
     public function serch(){
        $keywords = $_GET['keywords'];
        $m=M("text");
        $where['name']  = array("like","%{$keywords}%");
        $where['status'] = 1;
        $serch = $m->where($where)->select();
        //$s = $m->where("status = 1")->select();
        $count = $m->where($where)->count();
        //$c = $m->where("status = 1")->count();
        $this->assign("count",$count);
        $this->assign("serch",$serch);
        $this->display();
    }

    
}

